You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by bprager <be...@prager.ws> on 2015/02/02 21:15:57 UTC

gogo:source command not working

I am trying to script some command in Felix 4.6.0.
For some reason I am not able to get that working:

Am I missing something?
Thank you for any help.



--
View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: gogo:source command not working

Posted by bprager <be...@prager.ws>.
Wow. I did not see that.

It makes perfectly sense and is now working perfectly.
Thanks a lot, Derek.



--
View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362p5011388.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: gogo:source command not working

Posted by Derek Baum <de...@baums.org.uk>.
Your gosh_profile does not set SCOPE (similar to PATH in bash). This means that commands will be searched for in some non-deterministic order.

You can use the “type” command, to show where a particular command is found.
In this case “source” was resolved to “obr:source”:

[derek@delboy felix-framework-4.6.0]$ java -jar bin/felix.jar
hello from gosh profile
g! source hello.osh
g! type source
source is void obr:source(boolean, File, String[])
true
g!

If you want gogo:source, either specify the scope explicitly, or set SCOPE=gogo:*, to ensure the gogo: SCOPE is searched first.

—
Derek



> On 3 Feb 2015, at 17:54, bprager <be...@prager.ws> wrote:
> 
> Derek,
> 
> My custom gosh_profile only contains the single line: echo "Executing
> gosh_profile ..."
> 
> With gosh_profile in place the source command does NOT work.
> 
> See my example below (first use case below without, second case with
> gosh_profile in place):
> 
> g! -=[12:51:17][bernd_prager@NY01-9G7NJ12
> /cygdrive/c/bin/felix-framework-4.6.0]=-
> java -jar bin/felix.jar
> ____________________________
> Welcome to Apache Felix Gogo
> 
> g! source hello.osh
> echo "Hello, $1"
> g! type hello
> hello is function { echo "Hello, $1" }
> true
> g! stop 0
> g! 
> -=[12:52:06][bernd_prager@NY01-9G7NJ12
> /cygdrive/c/bin/felix-framework-4.6.0]=-
> mv etc/gosh_profile.bak etc/gosh_profile
> -=[12:52:17][bernd_prager@NY01-9G7NJ12
> /cygdrive/c/bin/felix-framework-4.6.0]=-
> java -jar bin/felix.jar
> Executing gosh_profile ...
> g! source hello.osh
> g! type hello
> type: hello not found.
> false
> g!
> 
> -- Bernd
> 
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362p5011386.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: gogo:source command not working

Posted by bprager <be...@prager.ws>.
Derek,

My custom gosh_profile only contains the single line: echo "Executing
gosh_profile ..."

With gosh_profile in place the source command does NOT work.

See my example below (first use case below without, second case with
gosh_profile in place):

g! -=[12:51:17][bernd_prager@NY01-9G7NJ12
/cygdrive/c/bin/felix-framework-4.6.0]=-
 java -jar bin/felix.jar
____________________________
Welcome to Apache Felix Gogo

g! source hello.osh
echo "Hello, $1"
g! type hello
hello is function { echo "Hello, $1" }
true
g! stop 0
g! 
-=[12:52:06][bernd_prager@NY01-9G7NJ12
/cygdrive/c/bin/felix-framework-4.6.0]=-
 mv etc/gosh_profile.bak etc/gosh_profile
-=[12:52:17][bernd_prager@NY01-9G7NJ12
/cygdrive/c/bin/felix-framework-4.6.0]=-
 java -jar bin/felix.jar
Executing gosh_profile ...
g! source hello.osh
g! type hello
type: hello not found.
false
g!

-- Bernd




--
View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362p5011386.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: gogo:source command not working

Posted by Derek Baum <de...@baums.org.uk>.
Hi Bernd,

gogo ships with a default gosh_profile embedded in the gogo-shell bundle.
It sets the default SCOPE=gogo:* and adds commands on BundleContext and System object.

Please show the contents of your etc/gosh_profile.

If it contains: .Gogo.format = false,
then this would explain why the source command is not showing any output.

You can check whether the source command has worked using:

g! type hello
hello is function { echo “Hello, $1!" }

—
Derek


> On 3 Feb 2015, at 15:59, bprager <be...@prager.ws> wrote:
> 
> Derek,
> 
> It turned out to be unrelated to the underlying OS. The culprit appears to
> be the gosh_profile script.
> If I have a gosh_profile script in place, Felix won't source any following
> script files anymore. Not sure why though. Here is my use case (1.: with
> gosh_profile, 2.: without gosh_profile):
> 
> -=[10:48:53][bernd_prager@NY01-9G7NJ12
> /cygdrive/c/bin/felix-framework-4.6.0]=-
> java -jar bin/felix.jar
> Executing gosh_profile ...
> g! source hello.osh
> g! stop 0
> g! -=[10:49:08][bernd_prager@NY01-9G7NJ12
> /cygdrive/c/bin/felix-framework-4.6.0]=-
> mv etc/gosh_profile etc/gosh_profile.bak
> -=[10:49:24][bernd_prager@NY01-9G7NJ12
> /cygdrive/c/bin/felix-framework-4.6.0]=-
> java -jar bin/felix.jar
> ____________________________
> Welcome to Apache Felix Gogo
> 
> g! source hello.osh
> echo "Hello, $1"
> g! stop 0
> g! -=[10:49:40][bernd_prager@NY01-9G7NJ12
> /cygdrive/c/bin/felix-framework-4.6.0]=-
> cat etc/gosh_profile.bak
> echo "Executing gosh_profile ..."
> 
> 
> I do wonder if you could replicate this. I have the same behavior on Windows
> and Linux.
> Thank you,
> -- Bernd
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362p5011382.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


Re: gogo:source command not working

Posted by bprager <be...@prager.ws>.
Derek,

It turned out to be unrelated to the underlying OS. The culprit appears to
be the gosh_profile script.
If I have a gosh_profile script in place, Felix won't source any following
script files anymore. Not sure why though. Here is my use case (1.: with
gosh_profile, 2.: without gosh_profile):

 -=[10:48:53][bernd_prager@NY01-9G7NJ12
/cygdrive/c/bin/felix-framework-4.6.0]=-
 java -jar bin/felix.jar
Executing gosh_profile ...
g! source hello.osh
g! stop 0
g! -=[10:49:08][bernd_prager@NY01-9G7NJ12
/cygdrive/c/bin/felix-framework-4.6.0]=-
 mv etc/gosh_profile etc/gosh_profile.bak
-=[10:49:24][bernd_prager@NY01-9G7NJ12
/cygdrive/c/bin/felix-framework-4.6.0]=-
 java -jar bin/felix.jar
____________________________
Welcome to Apache Felix Gogo

g! source hello.osh
echo "Hello, $1"
g! stop 0
g! -=[10:49:40][bernd_prager@NY01-9G7NJ12
/cygdrive/c/bin/felix-framework-4.6.0]=-
 cat etc/gosh_profile.bak
echo "Executing gosh_profile ..."


I do wonder if you could replicate this. I have the same behavior on Windows
and Linux.
Thank you,
-- Bernd



--
View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362p5011382.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: gogo:source command not working

Posted by Derek Baum <de...@baums.org.uk>.
So your complaint appears to be that gogo:source works on Linux, but not on Windows?


I use generally use Linux/OSX, so I know it works there.

I’ve just tested it on Windows7, and it looks fine to me:

C:\Users\derek\Desktop\felix-framework-4.6.0>java -jar bin\felix.jar
____________________________
Welcome to Apache Felix Gogo

g! cat hello.osh
hello = { echo "Hello, $1!" }
g!
g! hello
gogo: CommandNotFoundException: Command not found: hello
g! source hello.osh
echo "Hello, $1!"
g! hello Derek
Hello, Derek!
g!


Can you send some testcase to demonstrate your problem?

Thanks,

—
Derek


> On 2 Feb 2015, at 20:52, bprager <be...@prager.ws> wrote:
> 
> I am trying to collect a bundle of simple command, like adding a project
> specific repository, from a script file. For testing I just use the
> "gogo:echo" command in the script for now.
> 
> g! cat goshrc
> echo "local script"
> g! source goshrc
> g!
> 
> I did some more investigation and found out, that a script is executed
> perfectly in Linux (Ubuntu), but fails to execute in Windows7 (both native
> cmd or cygwin).
> 
> I can "gogo:cat" the content of the script, but "gogo:source" does not do
> anything.
> 
> 
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362p5011365.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


Re: gogo:source command not working

Posted by bprager <be...@prager.ws>.
I am trying to collect a bundle of simple command, like adding a project
specific repository, from a script file. For testing I just use the
"gogo:echo" command in the script for now.

g! cat goshrc
echo "local script"
g! source goshrc
g!

I did some more investigation and found out, that a script is executed
perfectly in Linux (Ubuntu), but fails to execute in Windows7 (both native
cmd or cygwin).

I can "gogo:cat" the content of the script, but "gogo:source" does not do
anything.





--
View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362p5011365.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: gogo:source command not working

Posted by Derek Baum <de...@baums.org.uk>.
Can you give more information on what you are trying to do, or why you think the gogo:source command  is not working?

—
Derek


> On 2 Feb 2015, at 20:15, bprager <be...@prager.ws> wrote:
> 
> I am trying to script some command in Felix 4.6.0.
> For some reason I am not able to get that working:
> 
> Am I missing something?
> Thank you for any help.
> 
> 
> 
> --
> View this message in context: http://apache-felix.18485.x6.nabble.com/gogo-source-command-not-working-tp5011362.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org