-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Exec2
, the "better version of Exec"
Add a new function `Exec2` which is as easy to use as `Exec` but much more powerful and less easy to misuse: - don't pass everything to a shell, thus avoiding compatibility issues due to different shells on different systems (this also has one downside: you can't use redirects like ">/dev/null") - pass arguments as separate strings, thus avoiding any issues with quoting quotes, quoting spaces, etc. - return the exit code of the executed command so that one can determine its success or failure; the return value is actually a record to allow returning other data, such as the programs output - make it very easy to override the input and output streams - by default, pass no input to the program (instead of passing anything the user might type, as `Exec` does); this can be changed by adding an input stream to the argument list - by default, capture any output of the program into a string and return it, instead of just printing the output to the console; this can be changed by adding an output stream to the argument list
- Loading branch information
Showing
4 changed files
with
111 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,3 +186,5 @@ DeclareOperation( "Process", | |
## <#/GAPDoc> | ||
## | ||
DeclareGlobalFunction( "Exec" ); | ||
|
||
DeclareGlobalName( "Exec2" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters