Skip to content

Commit 2463481

Browse files
Merge pull request #91 from esurov/executable
Make `scanner` executable
2 parents dd200a7 + 9e0033d commit 2463481

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

bin/build

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff 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

4657
unset($p);
4758
rename($output, $finalOutput);
4859

60+
chmod($finalOutput, 0755);
61+
4962
echo "$output successfully created";

0 commit comments

Comments
 (0)