Hi!

This patch fixes two problems with feathers that I have noticed being mentioned
on #chicken: the program argument is treated as a normal filename and looked
up like anz other file, not dependent on the current PATH. Also, in the case the
program wasn't found, the error message was not shown, due to the text widget
being disabled.


felix

From 80b27572d9613f3d2944404f745154779f910847 Mon Sep 17 00:00:00 2001
From: felix <fe...@call-with-current-continuation.org>
Date: Sun, 22 Apr 2018 16:00:08 +0200
Subject: [PATCH] Lookup the argument for the executable in feathers.

Also enable text widget in case error message is printed on startup.

Signed-off-by: felix <fe...@call-with-current-continuation.org>
---
 feathers.mdoc |  5 +++++
 feathers.tcl  | 19 +++++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
 mode change 100644 => 100755 feathers.tcl

diff --git a/feathers.mdoc b/feathers.mdoc
index ccfd9efa..01f8169b 100644
--- a/feathers.mdoc
+++ b/feathers.mdoc
@@ -48,6 +48,11 @@ environment variable
 which holds a connection address of the form
 .Ao ADDRESS Ac : Ns Ao PORT Ac .
 .Pp
+.Ar PROGRAM
+must give the path to the executable that is to be run,
+.Ev PATH 
+is not searched.
+.Pp
 The program accepts following arguments:
 .Bl -tag -width Ds
 .It Fl help
diff --git a/feathers.tcl b/feathers.tcl
old mode 100644
new mode 100755
index 1d896daa..0ad41c40
--- a/feathers.tcl
+++ b/feathers.tcl
@@ -700,7 +700,17 @@ proc RunProcess {{prg ""}} {
 
     if {$program_name == ""} return
 
-    lappend search_path [file dirname [lindex $program_name 0]]
+    set args [lassign $program_name prgfname]
+    set prgfname [file normalize $prgfname]
+
+    if {![file exists $prgfname]} {
+        .t configure -state normal
+        .t insert end "Could not start program:\n\nfile `$prgfname' does not exist"
+        .t see end
+        .t configure -state disabled
+    }
+
+    lappend search_path [file dirname $prgfname]
     set reply_queue {}
     set data_queue {}
     set bp_queue {}
@@ -728,8 +738,11 @@ proc RunProcess {{prg ""}} {
         .data.t delete [.data.t children $arguments_item_id]
     }
 
-    if {[catch {eval exec $program_name <@ stdin >@ stdout 2>@ stderr &} result]} {
+    if {[catch {eval exec $prgfname {*}$args <@ stdin >@ stdout 2>@ stderr &} result]} {
+        .t configure -state normal
         .t insert end "Could not start program:\n\n$result"
+        .t see end
+        .t configure -state disabled
     } else {
         set process_id $result
     }
@@ -1886,8 +1899,6 @@ if {$program_name != ""} {
 # - setting breakpoints on yet unregistered (i.e. dynamically loaded) files
 #   is not possible - a file must be registered first
 # - check whether "listening" check works
-# - backport to chicken4
-#   - feature ("dbg-client")
 # - when retrieved data is wrong, clear queues
 # - must watched globals be mangled, when qualified? (GET_GLOBAL)
 # - dview: monospace font (needs tags, it seems)
-- 
2.11.0

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to