1414use Hyperf \Engine \Channel ;
1515use Hyperf \Utils \Str ;
1616use Hyperf \Watcher \Option ;
17- use Swoole \Coroutine \System ;
17+
18+ use function Hyperf \Watcher \exec ;
1819
1920class FindNewerDriver extends AbstractDriver
2021{
@@ -27,13 +28,13 @@ class FindNewerDriver extends AbstractDriver
2728 public function __construct (protected Option $ option )
2829 {
2930 parent ::__construct ($ option );
30- $ ret = System:: exec ('which find ' );
31+ $ ret = exec ('which find ' );
3132 if (empty ($ ret ['output ' ])) {
3233 throw new \InvalidArgumentException ('find not exists. ' );
3334 }
3435 // create two files
35- System:: exec ('echo 1 > ' . $ this ->getToModifyFile ());
36- System:: exec ('echo 1 > ' . $ this ->getToScanFile ());
36+ exec ('echo 1 > ' . $ this ->getToModifyFile ());
37+ exec ('echo 1 > ' . $ this ->getToScanFile ());
3738 }
3839
3940 public function watch (Channel $ channel ): void
@@ -48,8 +49,8 @@ public function watch(Channel $channel): void
4849 ++$ this ->count ;
4950 // update mtime
5051 if ($ changedFiles ) {
51- System:: exec ('echo 1 > ' . $ this ->getToModifyFile ());
52- System:: exec ('echo 1 > ' . $ this ->getToScanFile ());
52+ exec ('echo 1 > ' . $ this ->getToModifyFile ());
53+ exec ('echo 1 > ' . $ this ->getToScanFile ());
5354 }
5455
5556 foreach ($ changedFiles as $ file ) {
@@ -75,7 +76,7 @@ protected function find(array $targets, array $ext = []): array
7576 $ shell = $ shell . sprintf ('find %s -newer %s -type f ' , $ dest , $ file ) . $ symbol ;
7677 }
7778
78- $ ret = System:: exec ($ shell );
79+ $ ret = exec ($ shell );
7980 if ($ ret ['code ' ] === 0 && strlen ($ ret ['output ' ])) {
8081 $ stdout = $ ret ['output ' ];
8182 $ lineArr = explode (PHP_EOL , $ stdout );
0 commit comments