Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds .crashd directory when running the program
This patch also adds a default value to the --args-file flag in the run command. When no --args-file is used, the run command looks for a file named args present in the $HOME/.crashd/ directory Signed-off-by: Sagar Muchhal <muchhals@vmware.com>
- Loading branch information
Showing
4 changed files
with
56 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
var ( | ||
// Directory path created at crashd runtime | ||
CrashdDir = filepath.Join(os.Getenv("HOME"), ".crashd") | ||
// file path of the defaults args file | ||
ArgsFile = filepath.Join(CrashdDir, "args") | ||
) | ||
|
||
// This creates a crashd directory which can be used as a default workdir | ||
// for script execution. It will also house the default args file. | ||
func CreateCrashdDir() error { | ||
if _, err := os.Stat(CrashdDir); os.IsNotExist(err) { | ||
return os.Mkdir(CrashdDir, 0755) | ||
} | ||
return nil | ||
} |
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