diff mbox series

[v8,03/13] qemu.py: use os.path.null instead of /dev/null

Message ID 20170901112829.2571-4-apahim@redhat.com
State New
Headers show
Series scripts/qemu.py fixes and cleanups | expand

Commit Message

Amador Pahim Sept. 1, 2017, 11:28 a.m. UTC
For increased portability, let's use os.path.devnull.

Signed-off-by: Amador Pahim <apahim@redhat.com>
---
 scripts/qemu.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Sept. 1, 2017, 11:39 a.m. UTC | #1
On 09/01/2017 08:28 AM, Amador Pahim wrote:
> For increased portability, let's use os.path.devnull.
> 
> Signed-off-by: Amador Pahim <apahim@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   scripts/qemu.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/qemu.py b/scripts/qemu.py
> index aca6fa4d82..a6e06291ea 100644
> --- a/scripts/qemu.py
> +++ b/scripts/qemu.py
> @@ -79,7 +79,7 @@ class QEMUMachine(object):
>           fd_param = ["%s" % self._socket_scm_helper,
>                       "%d" % self._qmp.get_sock_fd(),
>                       "%s" % fd_file_path]
> -        devnull = open('/dev/null', 'rb')
> +        devnull = open(os.path.devnull, 'rb')
>           p = subprocess.Popen(fd_param, stdin=devnull, stdout=subprocess.PIPE,
>                                stderr=subprocess.STDOUT)
>           output = p.communicate()[0]
> @@ -140,7 +140,7 @@ class QEMUMachine(object):
>   
>       def launch(self):
>           '''Launch the VM and establish a QMP connection'''
> -        devnull = open('/dev/null', 'rb')
> +        devnull = open(os.path.devnull, 'rb')
>           qemulog = open(self._qemu_log_path, 'wb')
>           try:
>               self._pre_launch()
>
Fam Zheng Sept. 5, 2017, 2:59 a.m. UTC | #2
On Fri, 09/01 13:28, Amador Pahim wrote:
> For increased portability, let's use os.path.devnull.
> 
> Signed-off-by: Amador Pahim <apahim@redhat.com>

Reviewed-by: Fam Zheng <famz@redhat.com>
diff mbox series

Patch

diff --git a/scripts/qemu.py b/scripts/qemu.py
index aca6fa4d82..a6e06291ea 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -79,7 +79,7 @@  class QEMUMachine(object):
         fd_param = ["%s" % self._socket_scm_helper,
                     "%d" % self._qmp.get_sock_fd(),
                     "%s" % fd_file_path]
-        devnull = open('/dev/null', 'rb')
+        devnull = open(os.path.devnull, 'rb')
         p = subprocess.Popen(fd_param, stdin=devnull, stdout=subprocess.PIPE,
                              stderr=subprocess.STDOUT)
         output = p.communicate()[0]
@@ -140,7 +140,7 @@  class QEMUMachine(object):
 
     def launch(self):
         '''Launch the VM and establish a QMP connection'''
-        devnull = open('/dev/null', 'rb')
+        devnull = open(os.path.devnull, 'rb')
         qemulog = open(self._qemu_log_path, 'wb')
         try:
             self._pre_launch()