Skip to content
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

je ne peux pas fermer un channel ! #3648

Closed
vicuna opened this issue Sep 9, 2002 · 1 comment
Closed

je ne peux pas fermer un channel ! #3648

vicuna opened this issue Sep 9, 2002 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 9, 2002

Original bug ID: 1378
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Salut à tous,

Voici mon problème :

Imaginons un out_channel oc connecté à un « broken pipe »
(relais brisé comme dit mon Linux francisé...).

Bon je fait

output_string oc "blabla\n" ;
flush oc

Il m'engueule, (exception Sys_error "Broken pipe"), normal.

Bon j'aime trouver le channel dans l'état où je l'ai trouvé donc

try
output_string oc "blabla\n" ;
flush oc
with
| Sys_error "Broken pipe" -> (* ouais peut être Sys_error _ *)
close_out oc

Le cercle vicieux typique paske close_out va appeler flush...

Bon c'est pas gravissime, je renonce :
(Pervasive.)exit retcode.

Mais là, play it again Sam, paske exit tente gentiment de me flusher
mes tampons ouverts, y compris celui pour lequel j'ai déjà essayé deux
fois. (Au passage l'échec de ``exit'' m'a pris par surprise).

Voici ma question :

En bref, comment fermer proprement mon oc, sans le flusher et
continuer ma route sans un out_channel qui me pèse sur la conscience.

Une piste et une dernière question :

  1. Faut il rendre la primitive ``close_out_channel'' qui ferme sans
    flusher accessible au commun des mortels ? Voire va-t-elle
    fonctionner ?

  2. Comment dire flusher en français ? Vider me semble un peu trop
    général.

--Luc

@vicuna
Copy link
Author

vicuna commented Sep 27, 2002

Comment author: administrator

Apres mure reflexion, nous avons decide:

  1. La fonction close ferme le channel.
  2. Par convenience, close essaye de flusher avant de fermer.
  3. Si ca foire, tant pis pour les donnees, on les jette.
  4. Si l'utilisateur veut recuperer les erreurs du flush, il n'a qu'a appeler
    flush avant close.

-- Damien
fix: 3.06+5 (2002-09-27)

@vicuna vicuna closed this as completed Sep 27, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant