Skip to content

Commit

Permalink
make BackgroundProcess constructor private
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Feb 16, 2023
1 parent 5876b7a commit ae0cdf4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/hx/concurrent/thread/BackgroundProcess.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class BackgroundProcess {
return new BackgroundProcessBuilder(executable);
}

/**
* @throws an exception in case the process cannot be created
*/
public static function create(executable:String, args:Array<AnyAsString>):BackgroundProcess {
return builder(executable).withArgs(args).build();
}
Expand All @@ -43,7 +46,6 @@ class BackgroundProcess {

final _args = new Array<String>();
public final args:ReadOnlyArray<String>;

public var workDir(default, null) = Sys.getCwd();

/**
Expand All @@ -70,10 +72,7 @@ class BackgroundProcess {

var process:Process = lazyNonNull();

/**
* @throws an exception in case the process cannot be created
*/
public function new(executable:String) {
private function new(executable:String) {
this.executable = executable;
args = this._args;
}
Expand Down Expand Up @@ -404,6 +403,9 @@ class BackgroundProcessBuilder {
process = new BackgroundProcess(executable);
}

/**
* @throws an exception in case the process cannot be created
*/
public function build():BackgroundProcess {
if (isBuilt)
throw "Already built!";
Expand All @@ -420,7 +422,6 @@ class BackgroundProcessBuilder {

public function withArgs(args:Array<AnyAsString>):BackgroundProcessBuilder {
for (arg in args) process._args.push(Std.string(arg));

return this;
}

Expand Down

0 comments on commit ae0cdf4

Please sign in to comment.