Add fork arg to shell_cmd
- Add support for a fork argument to the shell_cmd function.
- Also, some minor comment formatting changes to other gen_x.py files.
Change-Id: I71553793591086da2548d52dcac4d80e208755b0
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_cmd.py b/lib/gen_cmd.py
index bdd8258..81f64f0 100644
--- a/lib/gen_cmd.py
+++ b/lib/gen_cmd.py
@@ -288,7 +288,8 @@
retry_sleep_time=5,
allowed_shell_rcs=[0],
ignore_err=None,
- return_stderr=0):
+ return_stderr=0,
+ fork=0):
r"""
Run the given command string in a shell and return a tuple consisting of
the shell return code and the output.
@@ -351,6 +352,10 @@
such a case, the tuple returned by this
function will consist of three values
rather than just two: rc, stdout, stderr.
+ fork Run the command string asynchronously
+ (i.e. don't wait for status of the child
+ process and don't try to get
+ stdout/stderr).
"""
# Assign default values to some of the arguments to this function.
@@ -398,6 +403,8 @@
# Output from this loop iteration is written to func_stdout for later
# processing.
func_stdout = ""
+ if fork:
+ break
command_timed_out = False
if time_out is not None:
# Designate a SIGALRM handling function and set alarm.
diff --git a/lib/gen_plug_in_utils.py b/lib/gen_plug_in_utils.py
index 34b227f..d1eb8f6 100755
--- a/lib/gen_plug_in_utils.py
+++ b/lib/gen_plug_in_utils.py
@@ -51,7 +51,7 @@
This function also does the following:
- Set a default value for environment variable
- AUTOBOOT_OPENBMC_NICKNAME/AUTOIPL_FSP1_NICKNAME if it is not already set.
+ AUTOBOOT_OPENBMC_NICKNAME/AUTOIPL_FSP1_NICKNAME if it is not already set.
- Register PASSWORD variables to prevent their values from being printed.
Note: The programmer may set a default for any given environment variable
diff --git a/lib/gen_print.py b/lib/gen_print.py
index ed254fc..98ab72c 100755
--- a/lib/gen_print.py
+++ b/lib/gen_print.py
@@ -1624,11 +1624,11 @@
This function will...
- Expect that there is an sprint_foo_bar function already in existence.
- Create a print_foo_bar function which calls sprint_foo_bar and prints
- the result.
+ the result.
- Create a qprint_foo_bar function which calls upon sprint_foo_bar only if
- global value quiet is 0.
+ global value quiet is 0.
- Create a dprint_foo_bar function which calls upon sprint_foo_bar only if
- global value debug is 1.
+ global value debug is 1.
Also, code will be generated to define aliases for each function as well.
Each alias will be created by replacing "print_" in the function name with
diff --git a/lib/gen_valid.py b/lib/gen_valid.py
index f41c9cd..0c990b0 100755
--- a/lib/gen_valid.py
+++ b/lib/gen_valid.py
@@ -91,7 +91,7 @@
- If the error_message contains a value:
- Print the error_message as part of a full error report.
- If global exit_on_error is set, then exit the program with a return
- code of 1.
+ code of 1.
- If exit_on_error is not set, return False.
This function is designed solely for use by wrapper functions in this file