Closed bavarianbytes closed 6 years ago
@bavarianbytes
Yes, use can run a command via a target operation:
{
"deploy": {
"targets": [
{
"type": "test",
"name": "This is a test",
"deployed": [
{
"type": "open",
"target": "afplay",
"arguments": [ "/System/Library/Sounds/Glass.aiff" ],
"wait": false
}
]
}
]
}
}
Another way to do this is, is to run a script:
{
"deploy": {
"targets": [
{
// ...
"deployed": [
{
"type": "script",
"script": "./play-sound.js",
"options": "/System/Library/Sounds/Glass.aiff"
}
]
}
]
}
}
The script (./play-sound.js
) can look like that:
exports.execute = function(args) {
// s. https://nodejs.org/api/child_process.html#child_process_child_process_execfilesync_file_args_options
require('child_process').execFileSync(
"afplay",
[ args.options ] // "/System/Library/Sounds/Glass.aiff"
);
}
If you use relative paths, those paths are mapped to your workspace.
Thx for the extensive answer!
Hi, is there an option to run a command on the client after a deployment? I want to play a sound via
afplay /System/Library/Sounds/Glass.aiff
. Thx