-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ^D (EOF) to terminate the session #7
Conversation
if linep == nil { | ||
return "", io.EOF | ||
} | ||
line := *linep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this down to the next line and simply use: line := strings.TrimSuffix(*line, "\n")
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -101,15 +102,18 @@ func main() { | |||
for { | |||
cmdstr, err := t.promptForInput() | |||
if err != nil { | |||
if err == io.EOF { | |||
handleExit(t, dbgproc, 0) | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleExit should never return, it will call os.Exit - so this return shouldn't be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll remove the return a bit later, I'm just in the habit of being explicit about where the function execution terminates.
Merged, thanks! |
* [#175714387] Initial SMS Service * Add the sms to the db and return it via the api * Added the sms send worker, which calls alaris and gets the messageid * Update sms status and store message_id * Use SMS struct record for insert and check message size and for non GSM * Seperate the db code from the service function * Use utildb * [#175714387] Initial SMS Service * Setup the inbound server for sms service * Setup for DLR * Ok we are finally sending DLRS to inbound * Ok its a post you fool * Post DLR to DLR queue
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) go-delve#1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) go-delve#2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) go-delve#3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) go-delve#4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) go-delve#5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) go-delve#6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) go-delve#7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) go-delve#8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) go-delve#9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) go-delve#1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) go-delve#2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) go-delve#3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) go-delve#4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) go-delve#5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) go-delve#6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) go-delve#7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) go-delve#8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) go-delve#9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) #1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) #2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) #3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) #4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) #5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) #6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) #7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) #8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) #9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
`coredumpctl` attempts to pass the core file to the debugger through the `-c` flag. However delve does not support such a flag. This patch makes it a bool flag so we can receive the coredump file from `coredumpctl` $ GOTRACEBACK=crash ./main panic: goroutine 1 [running]: [....] zsh: IOT instruction (core dumped) GOTRACEBACK=crash ./main $ coredumpctl list main TIME PID UID GID SIG COREFILE EXE SIZE Tue 2022-11-15 23:29:07 CET 2047401 1000 1000 SIGABRT present /tmp/go-test/main 60.2K $ coredumpctl gdb --debugger=dlv -A core main PID: 2047401 (main) Signal: 6 (ABRT) Timestamp: Tue 2022-11-15 23:29:07 CET (1min 27s ago) Command Line: ./main Executable: /tmp/go-test/main Owner UID: 1000 (fox) Size on Disk: 60.2K Message: Process 2047401 (main) of user 1000 dumped core. Module /tmp/go-test/main without build-id. Stack trace of thread 2047401: #0 0x000000000045fa01 n/a (/tmp/go-test/main + 0x5fa01) #1 0x0000000000446d3e n/a (/tmp/go-test/main + 0x46d3e) #2 0x0000000000445487 n/a (/tmp/go-test/main + 0x45487) #3 0x000000000045fce6 n/a (/tmp/go-test/main + 0x5fce6) #4 0x000000000045fde0 n/a (/tmp/go-test/main + 0x5fde0) #5 0x0000000000432a49 n/a (/tmp/go-test/main + 0x32a49) #6 0x000000000043211a n/a (/tmp/go-test/main + 0x3211a) go-delve#7 0x000000000048d405 n/a (/tmp/go-test/main + 0x8d405) go-delve#8 0x0000000000434db2 n/a (/tmp/go-test/main + 0x34db2) go-delve#9 0x000000000045e0e1 n/a (/tmp/go-test/main + 0x5e0e1) ELF object binary architecture: AMD x86-64 [dlv core /tmp/go-test/main -c /var/tmp/coredump-JizL2g] Type 'help' for list of commands. (dlv) list main.main Showing /tmp/go-test/main.go:3 (PC: 0x457c26) 1: package main 2: 3: func main() { 4: panic() 5: } (dlv) Signed-off-by: Morten Linderud <morten@linderud.pw>
Or, at least, to terminate the session without printing an error.