File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,26 @@ if (1 == ini_get('phar.readonly')) {
3737// create phar
3838$ p = new Phar ($ output );
3939
40+ // start buffering. Mandatory to modify stub.
41+ $ p ->startBuffering ();
42+
43+ // pointing main file which requires all classes
44+ $ defaultStub = $ p ->createDefaultStub ('index.php ' , '/index.php ' );
45+
4046// creating our library using whole directory
4147$ p ->buildFromDirectory ($ input );
4248
43- // pointing main file which requires all classes
44- $ p ->setDefaultStub ('index.php ' , '/index.php ' );
49+ // Create a custom stub to add the shebang
50+ $ stub = "#!/usr/bin/env php \n" . $ defaultStub ;
51+
52+ // Add the stub
53+ $ p ->setStub ($ stub );
54+
55+ $ p ->stopBuffering ();
4556
4657unset($ p );
4758rename ($ output , $ finalOutput );
4859
60+ chmod ($ finalOutput , 0755 );
61+
4962echo "$ output successfully created " ;
You can’t perform that action at this time.
0 commit comments