-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Valid post/pre script format #265
base: master
Are you sure you want to change the base?
Conversation
Readme is updated with missing script format: a file with shebang chars and executable permissions
Subprocess exception handling is updated to print more information for the failed process call() reasons. This was particularly very useful when debugging why post/pre scripts are not executed properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. Left a few comments.
@@ -199,6 +199,17 @@ a new monitor, then you can use a `predetect` script to delay the execution. | |||
Write e.g. `sleep 1` into that file to make autorandr wait a second before | |||
running `xrandr`. | |||
|
|||
### Script format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually all that's needed is that the files are executable. They don't have to be shell scripts. (They don't even have to be scripts. A binary would work as well.)
@@ -1050,7 +1050,8 @@ def exec_scripts(profile_path, script_name, meta_information=None): | |||
if os.access(script, os.X_OK | os.F_OK): | |||
try: | |||
all_ok &= subprocess.call(script, env=env) != 0 | |||
except: | |||
except Exception as process_exception: | |||
print(process_exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a syntax error.
Besides, what's the idea behind this print
? Perhaps the same can be done more elegantly.
|
||
Each script you are placing under valid configuration folders must follow **bash/sh/yourshell** format. As an example; | ||
|
||
```bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of having a few examples. How about creating a folder under contrib
and collecting all sorts of scripts there? We could then link to that folder from here.
This pr includes 2 commits;