This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from mhearne-usgs/cmdfix
Removed dependency on impactutils cmd module, allowing us to have imp…
- Loading branch information
Showing
6 changed files
with
46 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ channels: | |
- conda-forge | ||
- defaults | ||
dependencies: | ||
- impactutils | ||
- numpy | ||
- pandas | ||
- scipy | ||
|
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python | ||
|
||
import subprocess | ||
|
||
|
||
def get_command_output(cmd): | ||
""" | ||
Method for calling external system command. | ||
Args: | ||
cmd: String command (e.g., 'ls -l', etc.). | ||
Returns: | ||
Three-element tuple containing a boolean indicating success or failure, | ||
the stdout from running the command, and stderr. | ||
""" | ||
proc = subprocess.Popen(cmd, | ||
shell=True, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE | ||
) | ||
stdout, stderr = proc.communicate() | ||
retcode = proc.returncode | ||
if retcode == 0: | ||
retcode = True | ||
else: | ||
retcode = False | ||
return (retcode, stdout, stderr) |
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
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