Skip to content

Commit

Permalink
docs(README.md): add section for fatal error and its fix
Browse files Browse the repository at this point in the history
- A new section has been added to the default README that addresses a fatal error related to misuse of shell builtins. The section includes an example of the error message and a code snippet demonstrating how to avoid the error by setting a sudo password.
  • Loading branch information
guanguans committed Jul 14, 2023
1 parent 2e5dd81 commit 55def24
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .lintmdrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"no-long-code": [
1,
{
"length": 1000,
"length": 10000,
"exclude": [
"dot"
]
Expand Down
9 changes: 9 additions & 0 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ $soar->clone() // Clone soar and avoid the option to manipulate the original soa
```
</details>

<details>
<summary><b>:warning: When running in a unix OS non-cli environment, may throw `Fatal error: ...Exit Code: 2(Misuse of shell builtins)...`</b></summary>

```php
// Fatal error: Uncaught Guanguans\SoarPHP\Exceptions\ProcessFailedException: The command "'/Users/yaozm/Documents/develop/soar-php/bin/soar.darwin-amd64' '-report-type=json' '-query=select * from users;'" failed. Exit Code: 2(Misuse of shell builtins) Working directory: /Users/yaozm/Documents/develop/soar-php Output: ================ Error Output: ================ panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1938665] goroutine 1 [running]: github.com/pingcap/tidb/util/memory.MemTotalNormal() pkg/mod/github.com/pingcap/[email protected]/util/memory/meminfo.go:41 +0x65 github.com/pingcap/tidb/util/memory.init.0() pkg/mod/github.com/pingcap/[email protected]/util/memory/meminfo.go:134 +0x175 in /Users/yaozm/Documents/develop/soar-php/src/Concerns/WithRunable.php:36 Stack trace: #0 /Users/yaozm/Documents/develop/soar-php/test.php(163): Guanguans\SoarPHP\Soar->run() #1 /User in /Users/yaozm/Documents/develop/soar-php/src/Concerns/WithRunable.php on line 36
$soar->setSudoPassword('your sudo password'); // Set a sudo password to run the soar command with sudo to avoid the above errors.
```
</details>

<details>
<summary><b>SQL Scores(SQL fingerprint、Score、Explain interpretation、Heuristic rule suggestions、Index rule suggestions)</b></summary>

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ $soar->clone() // 克隆 soar,避免操作原始 soar 的选项。
```
</details>

<details>
<summary><b>:warning: 在 unix 操作系统非 cli 环境中运行时,可能会抛出 `Fatal error: ...Exit Code: 2(Misuse of shell builtins)...`</b></summary>

```php
// Fatal error: Uncaught Guanguans\SoarPHP\Exceptions\ProcessFailedException: The command "'/Users/yaozm/Documents/develop/soar-php/bin/soar.darwin-amd64' '-report-type=json' '-query=select * from users;'" failed. Exit Code: 2(Misuse of shell builtins) Working directory: /Users/yaozm/Documents/develop/soar-php Output: ================ Error Output: ================ panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1938665] goroutine 1 [running]: github.com/pingcap/tidb/util/memory.MemTotalNormal() pkg/mod/github.com/pingcap/[email protected]/util/memory/meminfo.go:41 +0x65 github.com/pingcap/tidb/util/memory.init.0() pkg/mod/github.com/pingcap/[email protected]/util/memory/meminfo.go:134 +0x175 in /Users/yaozm/Documents/develop/soar-php/src/Concerns/WithRunable.php:36 Stack trace: #0 /Users/yaozm/Documents/develop/soar-php/test.php(163): Guanguans\SoarPHP\Soar->run() #1 /User in /Users/yaozm/Documents/develop/soar-php/src/Concerns/WithRunable.php on line 36
$soar->setSudoPassword('your sudo password'); // 设置 sudo 密码,以 sudo 运行 soar 命令,避免出现上述错误。
```
</details>

<details>
<summary><b>SQL 评分(SQL 指纹、分数、Explain 解读、启发式规则建议、索引规则建议)</b></summary>

Expand Down

0 comments on commit 55def24

Please sign in to comment.