Logs: liberachat/#haskell
| 2021-08-26 00:29:27 | <monochrom> | Ugh you know that a child's env vars are not "backported" to the parent, right? |
| 2021-08-26 00:29:36 | <lbseale> | I know now! |
| 2021-08-26 00:29:40 | <geekosaur> | your executable and any child processes will see it, the parent won't |
| 2021-08-26 00:29:55 | <lbseale> | ok, so this will not work, is there a way to do what I want? |
| 2021-08-26 00:30:27 | <lbseale> | I suppose write some bash script |
| 2021-08-26 00:30:55 | <monochrom> | It is very unclear what you want. |
| 2021-08-26 00:31:09 | <monochrom> | If you are in a shell, you already know the appropriate shell command for this. |
| 2021-08-26 00:31:30 | <monochrom> | If you are in a Haskell/C/Python program, you already know the appropriate library function to call. |
| 2021-08-26 00:31:50 | <nshepperd> | you want your program to set some environment variables in the parent shell? ssh-agent does this by outputting the commands to set the variables on stdout |
| 2021-08-26 00:31:53 | <monochrom> | So, what else is left? |
| 2021-08-26 00:32:08 | <lbseale> | monochrom: what nshepperd said |
| 2021-08-26 00:32:18 | <nshepperd> | and then you eval the commands in your shell |
| 2021-08-26 00:32:38 | <nshepperd> | like 'eval $(ssh-agent -s)' |
| 2021-08-26 00:33:29 | <lbseale> | understood, so I need to write a script that will use the output of my Haskell program to set the environment variable |
| 2021-08-26 00:34:49 | <monochrom> | You also know that unless you run, in the shell that you want to affect, "source that_script" or ". that_script", you would be back to the scenerio of "why can't child change parent's env", right? |
| 2021-08-26 00:34:49 | <nshepperd> | it should be a bash function |
| 2021-08-26 00:35:15 | <nshepperd> | or invoking 'source' yeah |
| 2021-08-26 00:35:28 | <nshepperd> | which runs the commands directly in the parent shell |
| 2021-08-26 00:35:43 | × | haykam quits (~haykam@static.100.2.21.65.clients.your-server.de) (Remote host closed the connection) |
| 2021-08-26 00:35:57 | → | haykam joins (~haykam@static.100.2.21.65.clients.your-server.de) |
| 2021-08-26 00:36:21 | × | Lord_of_Life quits (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 250 seconds) |
| 2021-08-26 00:36:23 | <monochrom> | I made exam questions like this for my unix course. |
| 2021-08-26 00:37:20 | <monochrom> | "Q2: John wants to edit PATH programmtically. Part (a): John makes it a shell script and run "./myscript", why no workie?" |
| 2021-08-26 00:37:34 | → | Lord_of_Life joins (~Lord@user/lord-of-life/x-2819915) |
| 2021-08-26 00:37:48 | × | pretty_dumm_guy quits (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Quit: WeeChat 3.2) |
| 2021-08-26 00:37:49 | <monochrom> | "Part (b): Make it a shell function." |
| 2021-08-26 00:38:26 | <lbseale> | hmm, I don't know the difference between a shell script and a shell function |
| 2021-08-26 00:39:08 | <monochrom> | Do you know the difference between doing a fork-exec and not doing even a fork? |
| 2021-08-26 00:40:07 | <lbseale> | I think I do, tell me if I'm wrong: fork exec runs something in a child process, and ... not fork doesn't create any process |
| 2021-08-26 00:40:34 | <monochrom> | If my command is "./myscript", does it do fork-exec? |
| 2021-08-26 00:40:52 | <lbseale> | I don't think so |
| 2021-08-26 00:41:06 | <monochrom> | Do you know how to test your hypothesis? |
| 2021-08-26 00:41:21 | <lbseale> | no |
| 2021-08-26 00:41:45 | <monochrom> | Do you know how the shell command for printing itself's process ID? |
| 2021-08-26 00:41:56 | <monochrom> | or s/the/a/ |
| 2021-08-26 00:42:49 | <lbseale> | SE tells me it's `echo $$` |
| 2021-08-26 00:43:01 | <monochrom> | Do you know how to test your hypothesis now? |
| 2021-08-26 00:43:48 | × | Ananta-shesha quits (~pjetcetal@2.95.210.196) (Quit: EXIT) |
| 2021-08-26 00:44:10 | <lbseale> | write a script that runs that and see if it's the same as if I just run it in the shell? |
| 2021-08-26 00:44:13 | → | Ananta-shesha joins (~pjetcetal@2.95.210.196) |
| 2021-08-26 00:44:20 | <monochrom> | Yes. |
| 2021-08-26 00:44:46 | <lbseale> | ok, did the test, it's not the same |
| 2021-08-26 00:44:59 | <lbseale> | so we have learned that `./myscript` does a fork-exec |
| 2021-08-26 00:45:18 | <lbseale> | and that any changes done to the environment in the script will not propagate up to the shell in which it was called |
| 2021-08-26 00:47:47 | <lbseale> | ... and `source myscript` does _not_ do a fork-exec |
| 2021-08-26 00:49:48 | <lbseale> | I supposed `.` is a synonym for `source` |
| 2021-08-26 00:50:18 | → | pbrisbin joins (~patrick@174-081-116-011.res.spectrum.com) |
| 2021-08-26 00:50:24 | <geekosaur> | yes, 'source' is actually a bash-ism, '.' is the old name |
| 2021-08-26 00:50:25 | → | abhixec joins (~abhixec@c-67-169-139-16.hsd1.ca.comcast.net) |
| 2021-08-26 00:50:39 | <lbseale> | nice! |
| 2021-08-26 00:51:06 | <geekosaur> | in particular '.' is POSIX and 'source' isn't |
| 2021-08-26 00:51:17 | <monochrom> | shell function has the advantage of syntactically looking like yet another command. |
| 2021-08-26 00:51:27 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2021-08-26 00:53:25 | → | d0ku joins (~d0ku@178.43.56.75.ipv4.supernova.orange.pl) |
| 2021-08-26 00:53:29 | × | haykam quits (~haykam@static.100.2.21.65.clients.your-server.de) (Remote host closed the connection) |
| 2021-08-26 00:53:42 | → | haykam joins (~haykam@static.100.2.21.65.clients.your-server.de) |
| 2021-08-26 00:57:19 | <lbseale> | I have to go now, thanks for the help! |
| 2021-08-26 00:57:55 | × | hyiltiz quits (~quassel@31.220.5.250) (Ping timeout: 252 seconds) |
| 2021-08-26 00:59:41 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-08-26 00:59:46 | → | hyiltiz joins (~quassel@31.220.5.250) |
| 2021-08-26 00:59:56 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-08-26 01:00:03 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-08-26 01:00:30 | <hololeap> | is there a foldMap for semigroups and non-empty lists? |
| 2021-08-26 01:01:08 | <Axman6> | @hoogle Semigroup m => (a -> m) -> t a -> m |
| 2021-08-26 01:01:09 | <lambdabot> | Data.Semigroup.Foldable foldMap1 :: (Foldable1 t, Semigroup m) => (a -> m) -> t a -> m |
| 2021-08-26 01:01:09 | <lambdabot> | Data.Semigroup.Foldable.Class foldMap1 :: (Foldable1 t, Semigroup m) => (a -> m) -> t a -> m |
| 2021-08-26 01:01:09 | <lambdabot> | Rebase.Prelude foldMap1 :: (Foldable1 t, Semigroup m) => (a -> m) -> t a -> m |
| 2021-08-26 01:01:47 | × | lbseale quits (~lbseale@user/ep1ctetus) (Read error: Connection reset by peer) |
| 2021-08-26 01:02:38 | × | machinedgod quits (~machinedg@135-23-192-217.cpe.pppoe.ca) (Read error: Connection reset by peer) |
| 2021-08-26 01:02:48 | → | machinedgod joins (~machinedg@135-23-192-217.cpe.pppoe.ca) |
| 2021-08-26 01:04:37 | <hololeap> | hm, Foldable1, good call |
| 2021-08-26 01:06:59 | <hololeap> | semigroupoids... semigroups... IN SPACE! |
| 2021-08-26 01:08:38 | Axman6 | wonders what a hemi-demi-semigroup would look like |
| 2021-08-26 01:09:45 | <c_wraith> | like a group, but with shoulders and arms. |
| 2021-08-26 01:12:23 | × | albet70 quits (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
| 2021-08-26 01:12:47 | × | d0ku quits (~d0ku@178.43.56.75.ipv4.supernova.orange.pl) (Ping timeout: 240 seconds) |
| 2021-08-26 01:13:30 | → | albet70 joins (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
| 2021-08-26 01:13:55 | → | neurocyte8306 joins (~neurocyte@46.243.82.232) |
| 2021-08-26 01:13:55 | × | neurocyte8306 quits (~neurocyte@46.243.82.232) (Changing host) |
| 2021-08-26 01:13:55 | → | neurocyte8306 joins (~neurocyte@user/neurocyte) |
| 2021-08-26 01:16:04 | × | neurocyte830 quits (~neurocyte@user/neurocyte) (Ping timeout: 252 seconds) |
| 2021-08-26 01:16:04 | neurocyte8306 | is now known as neurocyte830 |
| 2021-08-26 01:17:00 | × | chexum quits (~quassel@gateway/tor-sasl/chexum) (Ping timeout: 244 seconds) |
| 2021-08-26 01:18:56 | → | chexum joins (~quassel@gateway/tor-sasl/chexum) |
| 2021-08-26 01:30:36 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-08-26 01:31:33 | × | Vooch quits (~iovoo@096-038-011-034.biz.spectrum.com) (Read error: Connection reset by peer) |
| 2021-08-26 01:31:57 | → | Vooch joins (~iovoo@096-038-011-034.biz.spectrum.com) |
| 2021-08-26 01:34:47 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 240 seconds) |
| 2021-08-26 01:40:28 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-08-26 01:40:28 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Changing host) |
| 2021-08-26 01:40:28 | → | wroathe joins (~wroathe@user/wroathe) |
| 2021-08-26 01:40:47 | × | xff0x quits (~xff0x@2001:1a81:536c:3300:1de6:1836:7ec4:e477) (Ping timeout: 240 seconds) |
| 2021-08-26 01:41:40 | × | neo1 quits (~neo3@cpe-292712.ip.primehome.com) (Ping timeout: 250 seconds) |
| 2021-08-26 01:42:44 | → | xff0x joins (~xff0x@2001:1a81:53a5:7900:5864:fdd9:e9b9:647) |
| 2021-08-26 01:55:40 | × | pbrisbin quits (~patrick@174-081-116-011.res.spectrum.com) (Ping timeout: 252 seconds) |
| 2021-08-26 02:02:41 | × | epolanski quits (uid312403@id-312403.helmsley.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-08-26 02:04:22 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 2021-08-26 02:06:57 | → | slac56696 joins (~slack1256@181.203.37.78) |
| 2021-08-26 02:07:09 | × | betelgeuse quits (~betelgeus@94-225-47-8.access.telenet.be) (Read error: Connection reset by peer) |
| 2021-08-26 02:08:21 | → | betelgeuse2 joins (~betelgeus@94-225-47-8.access.telenet.be) |
All times are in UTC.