Skip to content

Commit 416c54a

Browse files
author
Greg Bowler
committed
Introduce Process class
1 parent e124798 commit 416c54a

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/Command/CreateCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function getDescription():string {
1919
/** @return NamedParameter[] */
2020
public function getRequiredNamedParameterList():array {
2121
return [
22-
"name"
22+
new NamedParameter("name")
2323
];
2424
}
2525

@@ -66,7 +66,11 @@ public function run(ArgumentValueList $arguments = null):void {
6666
$this->writeLine(
6767
"Using blueprint: $blueprint"
6868
);
69+
6970
exec("composer create-project --remove-vcs webengine-blueprints/$blueprint:dev-master $appDir");
71+
72+
$this->writeLine();
73+
$this->writeLine("Installation complete. Have fun! https://www.php.gt/documentation");
7074
// TODO: Future release of php.gt/config:
7175
// Use config-generate to set the correct namespace.
7276
// Update project's composer.json to autoload the correct application classes (from namespace).

src/Command/ServeCommand.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Gt\Cli\Command\Command;
77
use Gt\Cli\Parameter\NamedParameter;
88
use Gt\Cli\Parameter\Parameter;
9+
use Gt\Cli\Process\Process;
910
use Gt\Cli\Stream;
1011

1112
class ServeCommand extends Command {
@@ -47,7 +48,7 @@ public function run(ArgumentValueList $arguments = null):void {
4748
$gtServeCommand = implode(DIRECTORY_SEPARATOR, [
4849
"vendor",
4950
"bin",
50-
"gt-serve",
51+
"serve",
5152
]);
5253

5354
if(!file_exists($gtServeCommand)) {
@@ -59,10 +60,16 @@ public function run(ArgumentValueList $arguments = null):void {
5960
}
6061

6162
$cmd = implode(" ", [
62-
$gtServeCommand,
63-
"--port " . $arguments->get("port", 8080)
63+
// $gtServeCommand,
64+
"echo one && sleep 1 && echo two && sleep 1 && echo three"
65+
// "--port " . $arguments->get("port", 8080)
6466
]);
6567

66-
passthru($cmd);
68+
$process = new Process($cmd);
69+
$process->exec();
70+
71+
while($process->isAlive()) {
72+
echo $process->read();
73+
}
6774
}
6875
}

0 commit comments

Comments
 (0)