File tree 2 files changed +25
-6
lines changed
2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace Ziming \LaravelStatsig \Commands ;
6
6
7
+ use Exception ;
7
8
use Illuminate \Console \Command ;
9
+ use Illuminate \Process \Exceptions \ProcessTimedOutException ;
8
10
use Illuminate \Support \Facades \Process ;
9
11
use Statsig \Adapters \LocalFileLoggingAdapter ;
10
12
@@ -52,9 +54,16 @@ public function handle(): int
52
54
$ commandToRun .= ' ' .$ key .' ' .$ value ;
53
55
}
54
56
55
- $ result = Process::run ($ commandToRun );
56
- $ this ->info ($ result ->output ());
57
+ try {
58
+ $ result = Process::run ($ commandToRun );
59
+ $ this ->info ($ result ->output ());
60
+ return self ::SUCCESS ;
61
+ } catch (ProcessTimedOutException $ e ) {
62
+ report (
63
+ new Exception ('php ./vendor/statsig/statsigsdk/send.php has timed out ' )
64
+ );
65
+ }
57
66
58
- return $ result -> exitCode () ;
67
+ return self :: FAILURE ;
59
68
}
60
69
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace Ziming \LaravelStatsig \Commands ;
6
6
7
+ use Exception ;
7
8
use Illuminate \Console \Command ;
9
+ use Illuminate \Process \Exceptions \ProcessTimedOutException ;
8
10
use Illuminate \Support \Facades \Process ;
9
11
10
12
class StatsigSyncCommand extends Command
@@ -33,9 +35,17 @@ public function handle(): int
33
35
$ commandToRun .= ' ' .$ key .' ' .$ value ;
34
36
}
35
37
36
- $ result = Process::run ($ commandToRun );
37
- $ this ->info ($ result ->output ());
38
38
39
- return $ result ->exitCode ();
39
+ try {
40
+ $ result = Process::run ($ commandToRun );
41
+ $ this ->info ($ result ->output ());
42
+ return self ::SUCCESS ;
43
+ } catch (ProcessTimedOutException $ e ) {
44
+ report (
45
+ new Exception ('php ./vendor/statsig/statsigsdk/sync.php has timed out ' )
46
+ );
47
+ }
48
+
49
+ return self ::FAILURE ;
40
50
}
41
51
}
You can’t perform that action at this time.
0 commit comments