theprocess 0.0.1
The easy way to run external commands
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
The Process
This lib is designed to be able to easily run external process with complex configuration. It uses builder pattern to configure process (args, env, workdir, etc), thus it allows to easily use complex logic to prepare arguments and env for external process.
Current stage: Alpha
Just few real examples at the moment:
// Simply run git add command
Process("git")
.withArgs(["add", this.dst_info.path])
.inWorkDir(this.config.package_dir)
.execute
.ensureStatus;
// Run Odoo server with different args depending on configuration
auto runner = Process(venv_path.join("bin", "run-in-venv"))
.inWorkDir(_project.project_root.toString)
.withEnv(getServerEnv);
if (_project.odoo.server_user)
runner.setUser(_project.odoo.server_user);
if (coverage.enable) {
// Run server with coverage mode
runner.addArgs(
_project.venv.path.join("bin", "coverage").toString,
"run",
"--parallel-mode",
"--omit=*/__openerp__.py,*/__manifest__.py",
// TODO: Add --data-file option. possibly store it in CoverageOptions
);
if (coverage.source.length > 0)
runner.addArgs(
"--source=%s".format(
coverage.source.map!(p => p.toString).join(",")),
);
if (coverage.include.length > 0)
runner.addArgs(
"--include=%s".format(
coverage.include.map!(
p => p.toString ~ "/*").join(",")),
);
}
runner.addArgs(scriptPath.toString);
runner.addArgs(options);
if (detach) {
runner.setFlag(Config.detached);
runner.addArgs("--logfile=%s".format(_project.odoo.logfile));
}
auto pid = runner.spawn();
if (!detach)
std.process.wait(pid);
- 0.0.1 released a year ago
- katyukha/TheProcess
- MPL-2
- Copyright © 2023, Dmytro Katyukha
- Authors:
- Dependencies:
- thepath
- Versions:
-
0.0.7 2024-Oct-23 0.0.6 2024-Sep-26 0.0.5 2023-Aug-21 0.0.4 2023-Aug-03 0.0.3 2023-Jul-29 - Download Stats:
-
-
0 downloads today
-
16 downloads this week
-
170 downloads this month
-
1635 downloads total
-
- Score:
- 2.2
- Short URL:
- theprocess.dub.pm